package com.github.postsanf.yinian.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.github.postsanf.yinian.R;
import com.github.postsanf.yinian.bean.Tag;
import com.github.postsanf.yinian.bean.YNStatus;
import com.github.postsanf.yinian.constants.YNSingleton;
import com.github.postsanf.yinian.utils.StringUtils;
import com.github.postsanf.yinian.widget.TagCloudLinkView;
import com.umeng.analytics.MobclickAgent;

import java.util.List;

public class ShowTagDialog extends Activity {
    private TagCloudLinkView dialog_title;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_show_tag_dialog);
        dialog_title = (TagCloudLinkView) findViewById(R.id.dialog_title);
        dialog_title.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        YNStatus mCurStatus = YNSingleton.getInstance().getCurStatus();
        List<Tag> tags = mCurStatus.getTags();
        for (int j = 0; j < tags.size(); j++) {
            if (!StringUtils.isEmpty(tags.get(j).getTagContent())) {
                dialog_title.add(new Tag(j, tags.get(j).getTagContent()));
            }
        }
        dialog_title.drawTags(R.drawable.mycard_guide_tag_white, R.color.user_color_green, 12);
        dialog_title.setOnTagSelectListener(new TagCloudLinkView.OnTagSelectListener() {
            @Override
            public void onTagSelected(Tag tag, int position, View tagView, TextView textView) {
                finish();
            }
        });
        findViewById(R.id.show_location).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    // 友盟统计
    public void onResume() {
        super.onResume();
        MobclickAgent.onPageStart(this.getClass().getSimpleName());
        MobclickAgent.onResume(this);
    }

    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd(this.getClass().getSimpleName());
        MobclickAgent.onPause(this);
    }

}
